const routes = [
  {
    path: "/home",
    name: "home",
    meta: { title: "主页", type: "main", icon: "jxf-icon-home" },
    component: () => import("../views/index.vue"),
    // 动态设置组件name的方式
    // component: async () => {
    //     let _component = await import("../views/HomeView.vue");
    //     console.log(_component);
    //     _component.default.name = "about"; // 动态设置组件名
    //     return _component;
    //   },
    // },
  },
  {
    path: "/system",
    name: "system",
    meta: {
      title: "系统管理",
      isNotMenu: true,
      icon: "jxf-icon-system-management",
    },
    children: [
      {
        path: "/system/menu",
        name: "menues",
        meta: { title: "菜单管理" },
        component: () => import("../views/system/menu.vue"),
      },
      {
        path: "/system/user",
        name: "user",
        meta: { title: "用户管理" },
        component: () => import("../views/system/user.vue"),
      },
      {
        path: "/system/role",
        name: "role",
        meta: { title: "角色管理" },
        component: () => import("../views/system/role.vue"),
      },
      {
        path: "/system/setting",
        name: "setting",
        meta: { title: "设置" },
        component: () => import("../views/system/setting.vue"),
      },
    ],
  },
  {
    path: "/iframe",
    name: "iframe",
    meta: { title: "iframe", isNotMenu: true, icon: "jxf-icon-iframe" },
    children: [
      {
        path: "/iframe/vue3",
        name: "vue3",
        meta: { title: "vue3官方文档" },
        component: () => import("../views/iframe/vue3.vue"),
      },
      {
        path: "/iframe/vite",
        name: "vite",
        meta: { title: "vite官方文档" },
        component: () => import("../views/iframe/vite.vue"),
      },
      {
        path: "/iframe/element-plus",
        name: "element-plus",
        meta: {
          title: "element-plus官方文档",
        },
        component: () => import("../views/iframe/elementPlus.vue"),
      },
    ],
  },
  {
    path: "/components",
    name: "components",
    meta: { title: "组件", isNotMenu: true, icon: "jxf-icon-other" },
    children: [
      {
        path: "/components/upload",
        name: "components-upload",
        meta: { title: "上传" },
        component: () => import("../views/components/upload.vue"),
      },
      {
        path: "/components/regions",
        name: "components-regions",
        meta: { title: "地区选择" },
        component: () => import("../views/components/regions.vue"),
      },
      {
        path: "/components/qrcode",
        name: "components-qrcode",
        meta: { title: "二维码" },
        component: () => import("../views/components/qrcode.vue"),
      },
      {
        path: "/components/cropper",
        name: "components-cropper",
        meta: { title: "图片裁剪" },
        component: () => import("../views/components/cropper.vue"),
      },
      {
        path: "/components/compressImg",
        name: "components-compressImg",
        meta: { title: "图片压缩" },
        component: () => import("../views/components/compressImg.vue"),
      },
    ],
  },
  {
    path: "/other",
    name: "other",
    meta: { title: "其他", isNotMenu: true, icon: "jxf-icon-other" },
    children: [
      {
        path: "/other/icons",
        name: "icons",
        meta: { title: "字体图标" },
        component: () => import("../views/other/icons.vue"),
      },
      {
        path: "/other/useEcharts",
        name: "useEcharts",
        meta: { title: "数据展示Echarts" },
        component: () => import("../views/other/useEcharts.vue"),
      },
      {
        path: "/other/frontendExport",
        name: "other-frontendExport",
        meta: { title: "前端导出excel" },
        component: () => import("../views/other/frontEndExport.vue"),
      },
    ],
  },
];

export default routes;
